{include file='public/head'}
<body>
<style type="text/css" media="screen">
header {
    color: black;
}
</style>


<div class="x-body" >
	<form class="layui-form">

		<input type="hidden" name="id" value="{$data.id}">
		<div class="layui-form-item">
		    <label class="layui-form-label">用户名</label>
		    <div class="layui-input-block">
		    <input type="text" id="name" value="{$data.name}"  name="name" lay-verify="required" autocomplete="off" placeholder="请输入用户名" class="layui-input">
		    </div>
		  </div>

		<div class="layui-form-item">
		    <label class="layui-form-label">密&nbsp;&nbsp;&nbsp;码</label>
		    <div class="layui-input-block">
		    <input type="password" id="password"  name="password" lay-verify="pass" placeholder="留空为不修改" autocomplete="off" class="layui-input">
		    </div>
	  	</div>

	  	<div class="layui-form-item">
		    <label class="layui-form-label">确&nbsp;&nbsp;&nbsp;认</label>
		    <div class="layui-input-block">
		    	<input type="password"  id="check_password"  name="check_password"  placeholder="确认密码" autocomplete="off" class="layui-input">
		    </div>
	  	</div>
       <div class="layui-form-item">
		    <label class="layui-form-label">状&nbsp;&nbsp;&nbsp;态</label>
		    <div class="layui-input-block">
				 <input type="checkbox" name="state" {eq name="$data.state" value="0"}checked=""{/eq} lay-skin="switch" lay-text="正常|禁用">
		    </div>
	  	</div>

		<div class="layui-form-item">
		    <div class="layui-input-block">
		      <button style="margin-left: 20%" class="layui-btn" lay-submit="" lay-filter="editSubmit">提交</button>
		      <button id="reset" type="reset" class="layui-btn layui-btn-primary">重置</button>
		    </div>
		</div>


	</form>
</div>
</body>
<script>
layui.use('form', function () {
var form = layui.form,
jq = layui.jquery;
form.on('submit(editSubmit)', function (data) {
var state;
if(data.field.state=='on')
{
state='0';
}
else
{
state='1';
}
if(data.field.name=={$data.name} && data.field.password=='' && state=={$data.state})
{
var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}
loading = layer.load(2, {
	shade: [0.2, '#000']
});
var param = data.field;
jq.post('edit_Chat', param, function (data) {
if (data.code == 200) {
	layer.close(loading);
	layer.msg(data.msg, { icon: 1, time: 2000 }, function () {
	window.location.reload();
	});
} else {
	layer.close(loading);
	layer.msg(data.msg, { icon: 2, time: 2000 });
}
});
return false;
});
})
</script>
